package service

import (
	"context"
	tech "gitee.com/min65535/gotechback/api/v1/tech/pb"
	log "github.com/sirupsen/logrus"
)

// SaveEmail 实现EmailEventHTTPServer接口里的保存Email的service功能
func (b *BaseService) SaveEmail(ctx context.Context, req *tech.SaveEmailReq) (*tech.SaveEmailRsp, error) {

	if err := b.etx.SaveEmail(req.Email); err != nil {
		log.Errorf("BaseService#SaveEmail err:%v", err)
		return nil, err
	}

	return &tech.SaveEmailRsp{
		Rsp: &tech.Rsp{
			RespHead: &tech.RspHead{
				Code: 0,
				Desc: "success",
			},
		},
	}, nil
}
